package com.robert.jfinal.validator;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

/**
 * Created by zhenghao on 2016/3/22.
 */
public class MemberValidator extends Validator {
    @Override
    protected void validate(Controller c) {

        validateRequired("member.name","nameErrorMsg","请输入会员名称");
        validateRequired("member.age","ageErrorMsg","请输入会员名称");
        validateInteger("member.age",10,99,"ageErrorMsg","请输入10-99的数字");

    }

    @Override
    protected void handleError(Controller c) {

        //验证失败，跳转到指定页面
        c.render("add.html");

    }
}
